home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 8: LINUX Games
/
Linux Cubed Series 8 - LINUX Games.iso
/
games
/
x11
/
rpg
/
crossfir.000
/
crossfir
/
crossfire-0.92.4.client
/
README
< prev
next >
Wrap
Text File
|
1996-04-21
|
8KB
|
191 lines
This is the client distribution. It is still in developement, but
may be of interest to those who plan to do work, or just want tto see
how it works so far.
To use the client, do the following:
Change the configurable options in the Imakefile. The configurable ones
are those at the start of the file.
make the makefiles ("xmkmf -a")
Install the eutl package, and make sure that is compiled (likewise, you
may need to make some changes in the configuration of the Imakefile
to be set up correctly).
type 'make'.
You must also have/know of a server that supports the new client code.
You must also have the keybindings file installed. Best way to do
this is "mkdir ~/.crossfire" "cp def_keys ~/.crossfire/keys".
This file contains all the keybinds.
You can now run the client. In general, all you need to do
"cfclient -server <servername>", where <servername> is the host name
that is running a new server. -port will specify a different port.
You can do "cfclient -h" to see a full list of options.
------------------------------------------------------------------------------
This is the early stages of the new client server model.
My goal for the client is to try and limit all the windowing stuff
to one file. In this way, porting to other window systems (or
just different toolkits) should only require replacing that one file,
with hopefully no changes in the rest of the code.
In the ../server directory, changes have been made. All of them
shoulde be #ifdef NEW_CS In some cases, if the change does not
make the code incompatible, the #ifdef may not be in place.
In general, my working order on the client and server is in the order
that the client would make requests, and what the server sends back.
Thus, a bit of the initialization routines are done, but not a lot else.
Other notes: As of now, I plan to use the generic libcross library for a
lot of the code (it exists, and works). Thus, player inventory, and in fact
most code dealing with objects, will use the routines in the common/object.c
file. This should be redone sometime in the future - the object structure
used in the games stores a lot more information than what the client will
ever use.
The x11.c file is based on the server/xio.c file, with some changes
made. Only the code that has been modified is active, the rest
if #ifdef'd out. Some of the #ifdef'd code is out of date.
Using the player structure (in include/structs.h) will not happen. That
has a lot of information that will not be needed, and other stuff the
is window system dependant (which, as said above, needs to be in
x11.c).
If interested in working on some of this code, send me mail, along
with what you plan on working with. I will make sure that other
people do not work on the same area, and thus waste each others
time. Please, only send me mail saying you plan on working if you actually
expect to be able to got the work done in a reasonable amount of time
(since you will probably be working on just one of the protocol commands,
this might be around a month, but will vary.) Otherwise, if you say
you plan to get some of the code done, no one else will be working on
it, and it may never get done.
Mark Wedel
master@rahul.net
------------------------------------------------------------------------------
GENERAL IDEA IN THE CLIENT:
The overall working idea of the client is this:
1) Initialize all structures, and read in local data (archetypes,
images, etc)
2) Depending on flags, request missing data from server.
3) Login to server
4) It then repeats the following:
a) Check to see if new data has been received from the server
b) Check to see if any X events need to be processed
c) update all appropriate displays (might be done in calls in
a and b above)
d) See if we need to request more data from server, and do so
There is cases where depending on certain actions, the loop in stage
4 jumps to stage 3 (character dies, player wants to start new character,
etc).
Dealing with missing data:
At times, the archetype or image sent in an ITEM command is missing.
In that case, it needs to be requested from the server. But there is
a lag in this time. This is how it is handled:
Archetypes: Archetype data isn't needed, but it is very
convenient (gives animations, and basic properties.) When an archetype
not known by the client is sent, the client sets the slaying field
in the object to the archetype name, and adds that name to the list
of archetypes to request from the server.
When the archetype is then received, the client goes through all the
objects (shouldn't be that many), and any with the matching slaying
field are processed (assigned that archetype, and slaying field
is freed and reset.)
Images: When an image is missing, the client assigns an image number
that will be used when that image arrives. In the meantime, that
pixmap number is assigned to some other already used number (
right now, it is the stipple1 face.) When the actual image
arrives, the pixmap is then updated with this newly created image.
The update is then automatic the next time the image is drawn - instead
of using the stipple face that was assigned to that pixmap entry, it
will use the new face that was downloaded.
Note that in font mode, the stipple face id will still be assigned,
but new images can not be downloaded. Thus, for the remainder of
the session, the stipple image will be used for that object.
------------------------------------------------------------------------------
SERVER buffering/not buffering commands:
This is a description of how the server handles buffering, and what
some of the elements in the socket structure mean regarding this.
If command buffering is not set (default), then the server reads
the data from the socket. It processes all that data, and actual
player commands are then executed. If the player has insufficient
time to perform such an action, then that action is not performed, but
the data is dropped from the input stream. Input is still processed
until there is not input to read - thus many commands could be
dropped. (note that the protocol contains many commands which
the player does not execute, or that take 0 time. These will continue
to be processed. All commands that take player time will be dropped
until the player gains sufficient time.)
If command buffering is set, then the buffer_data element in the
socket is set.
Data is read in as before. This data is processed until it is either
all gone, or until the player runs out of time to execute more
commands (at which time, commands_blocked will be set.)
No further input processing happens at this time - the input that was
already read from the socket but not yer processed is stored in the save_buf
element.
In future loops, if the socket is no longer blocked,
then the data that is in the save_buf is processed. If after processing
this data, commands_blocked is still not set, then more data is read
from the socket, and processed.
The downside of this is twofold: 1) the input buffer could
overflow (not very likely unless the player is very slow or sending
a lot of commands), and 2) Even commands that take 0 time are
not processed.
Smarter processing of the input buffer should probably be done
at some time. But this becomes very difficult, because the ordering
of the commands is relevant. While a look_at command could perhaps
be a 0 time command, incorrect results would possibly be given
if player movements are in the buffer waiting to be processed.
------------------------------------------------------------------------------
Player's speed:
In the 'old' method, the players speed was increased. Then,
assuming he had sufficient speed, handle_player was called. This
would then take care of movement or any other commands, all of which
took time of 1.0. If after handle_player was called he still had
time, it would be called again (having sufficient time could be due to
a speed > 1.0, or if in combat, in which case weapon_sp is used.)
In the new method, commands are handled when data is read from the
socket, not in handle_player. As such, when data is read in, the
appropriate command is performed. When the player runs out of time,
he will not perform any more actions (what happens to the data
is determined by buffereing, see above.)
Commands have variable times. Putting on armour takes long than
picking up a coin.